#!/bin/bash

# 在指定目录下生成一个校验文件 参数1为文件名，并假装生成日志
function optest(){
    echo "1" > $1
    # 下面都是模拟安装的模拟日志
    echo -e "==========开始脚本：[$(date "+%Y-%m-%d %H:%M:%S")]==========\n\n" >> $install_log
    echo_log 0 版本：$InstallVersion
    sleep 2
    echo_log 0 版本：Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.163.com * epel: hk.mirrors.thegigabit.com * extras: ap.stykers.moe * updates: hk.mirrors.thegigabit.com Package gcc-4.8.5-39.el7.x86_64 already installed and latest version Package pcre-8.32-17.el7.x86_64 already installed and latest version Package pcre-devel-8.32-17.el7.x86_64 already installed and latest version Package zlib-1.2.7-18.el7.x86_64 already installed and latest version Package zlib-devel-1.2.7-18.el7.x86_64 already installed and latest version Package 1:openssl-1.0.2k-19.el7.x86_64 already installed and latest version Package 1:openssl-devel-1.0.2k-19.el7.x86_64 already installed and latest version Nothing to do
    echo_log 1 创建用户:$user
    sleep 4
    echo_log 0 第1次检查：一共有7/7个环境已被安装
    echo_log 3 "文件 $installFile 不存在，开始下载:$wgeturl"
    sleep 10
    echo -e "\n\n==========重新开始脚本：[$(date "+%Y-%m-%d %H:%M:%S")]==========" >> $install_log
    echo -e "==========开始脚本：[$(date "+%Y-%m-%d %H:%M:%S")]==========\n\n" >> $install_log
    echo_log 0 版本：$InstallVersion
    sleep 2
    echo_log 0 版本：Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.163.com * epel: hk.mirrors.thegigabit.com * extras: ap.stykers.moe * updates: hk.mirrors.thegigabit.com Package gcc-4.8.5-39.el7.x86_64 already installed and latest version Package pcre-8.32-17.el7.x86_64 already installed and latest version Package pcre-devel-8.32-17.el7.x86_64 already installed and latest version Package zlib-1.2.7-18.el7.x86_64 already installed and latest version Package zlib-devel-1.2.7-18.el7.x86_64 already installed and latest version Package 1:openssl-1.0.2k-19.el7.x86_64 already installed and latest version Package 1:openssl-devel-1.0.2k-19.el7.x86_64 already installed and latest version Nothing to do
    echo_log 1 创建用户:$user
    sleep 4
    echo_log 0 第1次检查：一共有7/7个环境已被安装
    sleep 1
    echo_log 1 解压完成
    sleep 5
    echo_log 1 配置、编译成功
    sleep 6
    echo_log 1 make isntall成功
    echo -e "==========安装结束：[$(date "+%Y-%m-%d %H:%M:%S")]==========" >> $install_log
    echo -e "==========生成init.d脚本：[$(date "+%Y-%m-%d %H:%M:%S")]==========\n\n" >> $install_log
    echo_log 1 "生成init.d脚本：init_$init_name"
    echo_log 1 "给予可执行权限：init_$init_name"
    echo_log 1 "复制至：/etc/init.d/$init_name"
    echo -e "\n\n==========生成结束：[$(date "+%Y-%m-%d %H:%M:%S")]==========\n\n" >> $install_log
    echo 完成测试安装
}